package com.xquant.common.engine.xPP.response;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.math.BigDecimal;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class UnderlyerValue {
    private String underlyerId;
    private String value;

    public String getUnderlyerId() {
        return underlyerId;
    }

    public void setUnderlyerId(String underlyerId) {
        this.underlyerId = underlyerId;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public void merge(UnderlyerValue underlyerValue){
        String value = underlyerValue.getValue()==null?"0":underlyerValue.getValue();
        this.value = String.valueOf(this.value == null ? BigDecimal.ZERO.add(new BigDecimal(value)) : new BigDecimal(this.value).add(new BigDecimal(value)));
    }
}
